Learn With Reshu is here to help you all to get new Technological ideas and knowledge. I will try to create blogs on all technical topics and new tricks and tips. please do like share and subscribe Learn with Reshu to encourage me more for creating good help to others.
Thanks,
Best Regards
#learnwithReshu
Advanced Java Programming Advanced Java Programming :- Introduction to advance java As most of us already know that if we want to make normal applications it can be easily built using core Java concepts. But, when it we need to develop web applications, advanced Java fundamentals, like JSP, Servlets, JDBC etc. needed, so to add capabilities and features of the application advance java is essential for developers. Through the motive of this blog is to explain about Advanced Java, I will be giving you a complete insight into the fundamental concepts of Advance Java. Figure - 1.2 If you want to see complete video on this please have a look the video below. Learn with Resh u Advanced Java Programming Course ...
Get link
Facebook
X
Pinterest
Email
Other Apps
Complete Guide for if else Statement.
Get link
Facebook
X
Pinterest
Email
Other Apps
-
Complete Guide for if else Statement.
Java has the following conditional statements:
Use if to specify a block of code to be executed, if a specified condition is true
Use else to specify a block of code to be executed, if the same condition is false
Use else if to specify a new condition to test, if the first condition is false
Use switch to specify many alternative blocks of code to be executed
Java supports the usual logical conditions from mathematics:
Less than: a < b
Less than or equal to: a <= b
Greater than: a > b
Greater than or equal to: a >= b
Equal to a == b
Not Equal to: a != b
You can use these conditions to perform different actions for different decisions.
The if Statement
Use the if statement to specify a block of Java code to be executed if a condition is true.
Syntax
if(condition){// block of code to be executed if the condition is true}
Note that if is in lowercase letters. Uppercase letters (If or IF) will generate an error. In the example below, we test two values to find out if 21 is greater than 19. If the condition is true, print some text:
Example
if(21 >19){System.out.println("21 is greater than 19");}
As Same way we can also test variables:
Example
int x =22;int y =20;if(x > y){System.out.println("x is greater than y");}
Example explained
In the example above we use two variables,xandy, to test whether x is greater than y (using the>operator). As x is 22, and y is 20, and we know that 22 is greater than 20, we print to the screen that "x is greater than y". No turn comes for
The else Statement
We use elsestatement to specify a block of code to be executed if the condition in if isfalse.
Syntax
if(condition){// block of code to be executed if the condition is true}else{// block of code to be executed if the condition is false
}
Example
int number =10;if(number>18){System.out.println("Hello.");}else{System.out.println("Bye.");}
// Outputs "Bye."
Example explained
In the example above, number (10) is less than 18, so the condition is false. Because of this, we move on to the else condition and print to the screen "Bye". If the number was greater than 18, the program would print "Hello".
The else if Statement
We use the else if statement to specify a new condition if the first condition defined in if is false.
Syntax
if(condition1){// block of code to be executed if condition1 is true}elseif(condition2){// block of code to be executed if the condition1 is false and condition2 is true}else{// block of code to be executed if the condition1 is false and condition2 is false}
Example
int number =22;if(number<10){System.out.println("Good morning.");}elseif(number<20){System.out.println("Good day.");}else{System.out.println("Good evening.");}// Outputs "Good evening."
Example explained
In the example above, number (22) is greater than 10, so the first condition is false. The next condition, in the else if statement, is also false, so we move on to the else condition since condition1 and condition2 is both false - and print to the screen "Good evening".
However, if the number was 14, our program would print "Good day."
Learn Complete OOPS Concepts in one Project In this Page i will give a example Code for covering all oops concepts in only one single project. Class Model Code Example Explanation:- Suppose there is a Organization which has many departments and many Employees Some Employees are Part of Some Departments So In this Code example What i have created is A Organization Class Which is having Many Employees so One Employee Class and Employee is a part of Departments so We have Created one Departments Class Now Organization, Department and Employee has some task to be done so for that i have created Interfaces for each one where i H...
The “Spring Framework” is a large project. Under the Spring Framework label are actually about 20 different Spring projects. Spring MVC, Spring Security, Spring Integration, etc. So, it would be easy to get confused about what “Spring Core” is. The official Spring documentation, contains this image: “Spring Core” is typically used to refer to the functionality of the Core container. Beans, Core, Context, and SpEL. While there are about 30 Spring Framework projects, they all depend on this core container. Its this core functionality that has been around since the beginning of the Spring Framework. The core container, which has the Spring Context, manages dependency injection for us via Inversion of Control is used by all other Spring projects. Spring Boot Application In Hindi Cheers, Learn with Reshu
Polymorphism in Java Method Overriding and Method OverLoading in Java Java Polymorphism Polymorphism means "many forms", and it occurs when we have many classes that are related to each other by inheritance. Like we specified in the previous Blog; Inheritance lets us inherit attributes and methods from another class. Polymorphism uses those methods to perform different tasks. This allows us to perform a single action in different ways. Polymorphism are two types Method Overriding : It calls as compile time polymorphism or static or early binding. Method Overloading: It calls as Runtime polymorphism or dynamic or late binding. For example, think of a superclass called Animal that has a method called animalSound() . Subclasses of Animals could be Pigs, Cats, Dogs, Birds - And they also have their own implementation of an animal sound (the pig oinks, and the cat meows, etc.): This is a example o...
Comments
Post a Comment
Please do not comment any spam link in the comment box